"""
    
    Application main class.

"""

__author__ = "Mikko Ohtamaa <mikko@redinnovation.com>"
__docformat__ = "epytext"
__copyright__ = "Red Innovation Ltd."
__license__ = "BSD"

import os
import sys

class Application:
    """ Mobile application with logging support and thread awarness. """
    
    def __init__(self):
        self.path = os.getcwd()
        
    def is_debugging(self):
        """ Is application running in the debugging mode.
                
        @rtype: bool
        """
        return False
    
    def get_name(self):
        """ Get application identified.
        
        Used to identify lock files, etc.
        
        @rtype: string
        """
        raise NotImplementedError()
    
    def get_app_path(self):
        """
        
        @return: Absolute path to the application main module folder
        @rtype: string
        """        
        return self.path
        
    def prepare(self):
        """ Perform application specific initialization after the framework has been loaded.
        
        During this function, the application splash screen is visible.
        """
        pass
    
    def get_logger(self):
        """ Get multihread aware logger.
                
        @return: logging.Logger object
        """
        raise NotImplementedError()
    
    def exit(self):
        raise NotImplementedError()
    
    def run(self):
        """ Application entry point.
        
        The subclass must override this.        
        """
        raise NotImplementedError()
    
    def cycle_main_loop(self):
        pass
    
    def start(self):
        """ Call this in the application entry thread.
        
        """
        self.run()